package com.neusoft.elm.infrastructure.config;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class AppConfig {
    private static final Properties properties = new Properties();
    
    static {
        try (InputStream input = AppConfig.class.getClassLoader().getResourceAsStream("application.properties")) {
            if (input == null) {
                throw new RuntimeException("无法找到 application.properties");
            }
            properties.load(input);
        } catch (IOException e) {
            throw new RuntimeException("加载配置文件失败", e);
        }
    }
    
    public static String getProperty(String key) {
        return properties.getProperty(key);
    }
    
    public static String getDbUrl() {
        return getProperty("db.url");
    }
    
    public static String getDbDriver() {
        return getProperty("db.driver");
    }
    
    public static String getDbUsername() {
        return getProperty("db.username");
    }
    
    public static String getDbPassword() {
        return getProperty("db.password");
    }
} 